package com.love.netty.core.interfaces.impl;

import com.love.netty.core.interfaces.ConsoleCommand;
import com.love.netty.core.packet.request.JoinGroupRequestPacket;
import io.netty.channel.Channel;

import java.util.Scanner;

/**
 * @ClassName: JoinGroupConsoleCommand
 * @Description: 群加入命令处理器
 * @Author: wuj
 * @Date: 2021-06-25 14:51
 **/
public class JoinGroupConsoleCommand implements ConsoleCommand {

    @Override
    public void exec(Scanner scanner, Channel channel) {
        JoinGroupRequestPacket joinGroupRequestPacket = new JoinGroupRequestPacket();

        System.out.print("输入 groupId，加入群聊：");
        String groupId = scanner.next();

        joinGroupRequestPacket.setGroupId(groupId);
        channel.writeAndFlush(joinGroupRequestPacket);
    }
}
